#include <iostream>
#include "log.h"
#include <thread>
#include "util.h"
int main(int argc, char **argv)
{
    std::cout<<"hello"<<std::endl;
    yuechuan::Logger::ptr logger(new yuechuan::Logger);
    logger->addAppender(yuechuan::LogAppender::ptr(new yuechuan::StdoutLogAppender));
    

    // yuechuan::LogEvent::ptr event(new yuechuan::LogEvent(__FILE__, __LINE__, 0, yuechuan::GetThreadId(), yuechuan::GetThreadId(), time(0)));

    // logger->log(yuechuan::LogLevel::DEBUG, event);

    yuechuan::FileLogAppender::ptr file_appender(new yuechuan::FileLogAppender("./log.txt"));
    logger->addAppender(file_appender);

    yuechuan::LogFormatter::ptr fmt(new yuechuan::LogFormatter("%d%T%p%T%m%n"));
    file_appender->setLogFormatter(fmt);
    file_appender->setLevel(yuechuan::LogLevel::ERROR);

    YUECHUAN_LOG_DEBUG(logger) << "test log Debug";
    YUECHUAN_LOG_ERROR(logger) << "test log Error";

    auto l = yuechuan::LoggerMgr::GetInstance()->getLogger("XX");
    YUECHUAN_LOG_INFO(l) << "XXX";

    return 0;
}